import request from "@/utils/request"
import type { tradeMarkListResponse, trademarkItem } from "./model/trademarkModel"

enum Api {
  getTradeMarkList = "/admin/product/baseTrademark",
  delTrademark = "/admin/product/baseTrademark/remove", // /admin/product/baseTrademark/remove/{id} delete
  updateTrademark = "/admin/product/baseTrademark/update", //put
  addTrademark = "/admin/product/baseTrademark/save", // post
}

// 获取商品列表
export const reqTradeMarkListApi = (page: number, limit: number) => {
  return request.get<any, tradeMarkListResponse>(
    `${Api.getTradeMarkList}/${page}/${limit}`
  )
}

// 删除商品
export const delTradeMarkApi = (id: number) => {
  return request.delete<any, null>(`${Api.delTrademark}/${id}`)
}
// 添加商品
export const addTradeMarkApi = (tmName: string, logoUrl: string) => {
  return request.post<any, null>(`${Api.addTrademark}`,{
    tmName,
    logoUrl
  })
}
// 编辑商品
export const updateTradeMarkApi = (tm:trademarkItem) => {
  return request.put<any, null>(`${Api.updateTrademark}`,tm)
}
